\chapter{Implementation}
In this chapter the implementation of the program is discussed. Everything from the initial states of planning the program to the algorithms used and how the code works.

\section{Language}
%\textbf{Here is something we can maybe use when talking about choice of programming language (http://www.dspguide.com/ch4/5.htm): "Which programming language should you use? That depends on who you are and what you plan to do. Most computer scientists and programmers use C (or the more advanced C++). Power, flexibility, modularity; C has it all. C is so popular, the question becomes: Why would anyone program their DSP application in something other than C? Three answers come to mind [...]" - Gustav, 25 May}

For this project Java was chosen as the programming language used to create the program. This was done for several reasons:

\begin{itemize}
\item Java was taught as a part of this semester's programming course.
\item It was planned that the program should work on tablets as well - e.g. Android, which allows for programs written in Java.
\item The programming teacher on this semester recommended some libraries based on Java.
\item It seemed ideal to use Java to further practice the group's skills and familiarity with the language.
\end{itemize}

The program was designed with both computers and tablets in mind. Especially the Android platform seemed appealing, since it allows relatively easy cross-development on both computers and the Android OS.

In general, the Java programming language has a wide target range, since it can run on a lot of different machines and operating systems, as long as they have implemented the Java Virtual Machine.

\section{Libraries}
When researching what libraries that were to be used for the program, something that also had a big influence on what language was chosen, the programming lecturer suggested a Java library called \textit{Minim} \cite{minimWeb}. The group decided to work with this, since it allowed for some basic audio tools that were needed in the development of the program.

The lecturer also suggested a GUI library called ControlP5 \cite{websiteControlP5}. Although ControlP5 is built for the Processing programming language, it can also run in Java.

\subsection{Minim}
The library's website describes Minim with the following words:
\textit{"Minim is an audio library that uses the JavaSound API, a bit of Tritonus, and Javazoom's MP3SPI to provide an easy to use audio library for people developing in the Processing environment. The philosophy behind the API is to make integrating audio into your sketches as simple as possible while still providing a reasonable amount of flexibility for more advanced users. There are no callbacks and you do not ever need to directly manipulate sample arrays, all of the dirty work is handled for you."} \cite{minimWeb}

Minim provides features in the form of various class files, such as an \textit{AudioPlayer} for the playback of music files (WAV, MP3, etc.); \textit{AudioRecorder} for recording via a microphone; \textit{AudioSignal} for making synthesis such as generating oscillators; \textit{AudioEffect} that provides a simple interface for implementing effects such as low/high/band/notch pass filters and more; \textit{FFT} for doing spectrum analysis; and a \textit{BeatDetect} for beat detection in music.

\subsection{ControlP5}
ControlP5 was chosen, since it provides some easy-to-use classes for common interface elements such as buttons, sliders, knobs and text fields (see figure \ref{fig:controlP5}). Also, the example files attached to the Minim library utilizes ControlP5, so it was only natural to use ControlP5.